// 国家代码配置
export const COUNTRY_CODES = [
  {
    code: '+86',
    name: '中国',
    flag: '🇨🇳',
    countryCode: 'CN'
  },
  {
    code: '+1',
    name: '美国',
    flag: '🇺🇸',
    countryCode: 'US'
  },
  {
    code: '+44',
    name: '英国',
    flag: '🇬🇧',
    countryCode: 'GB'
  },
  {
    code: '+81',
    name: '日本',
    flag: '🇯🇵',
    countryCode: 'JP'
  },
  {
    code: '+82',
    name: '韩国',
    flag: '🇰🇷',
    countryCode: 'KR'
  },
  {
    code: '+65',
    name: '新加坡',
    flag: '🇸🇬',
    countryCode: 'SG'
  },
  {
    code: '+852',
    name: '香港',
    flag: '🇭🇰',
    countryCode: 'HK'
  },
  {
    code: '+853',
    name: '澳门',
    flag: '🇲🇴',
    countryCode: 'MO'
  },
  {
    code: '+886',
    name: '台湾',
    flag: '🇹🇼',
    countryCode: 'TW'
  },
  {
    code: '+60',
    name: '马来西亚',
    flag: '🇲🇾',
    countryCode: 'MY'
  },
  {
    code: '+66',
    name: '泰国',
    flag: '🇹🇭',
    countryCode: 'TH'
  },
  {
    code: '+84',
    name: '越南',
    flag: '🇻🇳',
    countryCode: 'VN'
  },
  {
    code: '+63',
    name: '菲律宾',
    flag: '🇵🇭',
    countryCode: 'PH'
  },
  {
    code: '+62',
    name: '印度尼西亚',
    flag: '🇮🇩',
    countryCode: 'ID'
  },
  {
    code: '+91',
    name: '印度',
    flag: '🇮🇳',
    countryCode: 'IN'
  },
  {
    code: '+61',
    name: '澳大利亚',
    flag: '🇦🇺',
    countryCode: 'AU'
  },
  {
    code: '+64',
    name: '新西兰',
    flag: '🇳🇿',
    countryCode: 'NZ'
  },
  {
    code: '+33',
    name: '法国',
    flag: '🇫🇷',
    countryCode: 'FR'
  },
  {
    code: '+49',
    name: '德国',
    flag: '🇩🇪',
    countryCode: 'DE'
  },
  {
    code: '+39',
    name: '意大利',
    flag: '🇮🇹',
    countryCode: 'IT'
  },
  {
    code: '+34',
    name: '西班牙',
    flag: '🇪🇸',
    countryCode: 'ES'
  },
  {
    code: '+7',
    name: '俄罗斯',
    flag: '🇷🇺',
    countryCode: 'RU'
  },
  {
    code: '+55',
    name: '巴西',
    flag: '🇧🇷',
    countryCode: 'BR'
  },
  {
    code: '+52',
    name: '墨西哥',
    flag: '🇲🇽',
    countryCode: 'MX'
  },
  {
    code: '+1',
    name: '加拿大',
    flag: '🇨🇦',
    countryCode: 'CA'
  }
];

// 默认国家代码（中国）
export const DEFAULT_COUNTRY_CODE = '+86';

// 根据代码获取国家信息
export function getCountryByCode(code) {
  return COUNTRY_CODES.find((country) => country.code === code) || COUNTRY_CODES[0];
}

// 根据国家代码获取国家信息
export function getCountryByCountryCode(countryCode) {
  return COUNTRY_CODES.find((country) => country.countryCode === countryCode) || COUNTRY_CODES[0];
}
